<template>
	<view class="page">
		<view class="searchBox">
			<view class="inputBox">
				<view class="inputRow" style="" >
					<view class="label">
						学号:
					</view>
					<view :class="selectLabel ? 'val' : 'emty'" @click="selectListShow=true">
						{{selectLabel ? selectLabel : '请选择' }}
					</view>
				</view>
				<view class="inputRow" style="" >
					<view class="label">
						姓名:
					</view>
					<view :class="selectLabel ? 'val' : 'emty'" @click="selectListShow=true">
						{{selectLabel ? selectLabel : '请选择' }}
					</view>
				</view>
				<view class="inputRow">
					<view class="label">
						开始时间:
					</view>
					<view :class="params.beginTime ? 'val' : 'emty'" @click="beginTimeShow=true">
						{{params.beginTime ? params.beginTime : '请选择' }}
					</view>
				</view>
				<view class="inputRow">
						<view class="label">
							结束时间:
						</view>
						<view :class="params.endTime ? 'val' : 'emty'" @click="endTimeShow=true">
							{{params.endTime ? params.endTime : '请选择' }}
						</view>
				</view>
			</view>
			<view class="btnBox">
				<view class="btn"  @click="goSearch">
					搜索
				</view>
			</view>
			
		</view>
		
			<scrollYBox styleText="height: calc( 100vh - 360rpx );" @scrolltolower="scrolltolower" :list="list">
						<template>
							<view style="padding-bottom: 50rpx;">
								<view class="boxItem" v-for="(item,index) in list" :key="index">
									<view class="row flex">
										<view class="item ">
											<view class="label">
												班级
											</view>
											<view class="val">
												{{item.transAmt | emptyStr }}
											</view>
										</view>
										<view class="item ">
											<view class="label">
												学号
											</view>
											<view class="val">
												{{item.transAmt | emptyStr }}
											</view>
										</view>
										<view class="item ">
											<view class="label">
												学生姓名
											</view>
											<view class="val">
												{{item.accountPayAmount | emptyStr }}
											</view>
										</view>
									</view>
									<view class="row flex">
										<view class="item ">
											<view class="label">
												日期
											</view>
											<view class="val">
												{{item.transAmt | emptyStr }}
											</view>
										</view>
										<view class="item ">
											<view class="label">
												考勤结果
											</view>
											<view class="val">
												{{item.accountPayAmount | emptyStr }}
											</view>
										</view>
									</view>
								</view>
							</view>
						</template>
					</scrollYBox>
	
		<u-datetime-picker
		    :show="beginTimeShow" ref="datetimePicker" v-model="beginTime" 
		    mode="date"  @cancel="beginTimeShow=false" @confirm="beginTimeConfirm"
		       ></u-datetime-picker>
		<u-datetime-picker
			:show="endTimeShow" ref="datetimePicker" v-model="endTime" 
			mode="date"  @cancel="endTimeShow=false" @confirm="endTimeConfirm"
	       ></u-datetime-picker>
		<u-picker :show="selectListShow" :columns="selectList" keyName="label"
			@cancel="selectListShow = false"></u-picker>
	</view>
</template>

<script>
	import {cardOperationlistApi} from '@/common/api/commonApi/commonApi.js'
	import scollerXTabel from '@/components/scollerXTabel.vue'
	export default {
		data() {
			return {
				list:[{}],
				params:{
					mainframeNo : '',
					currPage : 1,
					pageSize : 15,
					beginTime : '',
					endTime : '',
					transChannl : '',
					memberNo : uni.getStorageSync('selectInfoAccount').memberNo
				},
				beginTime: Number(new Date()),
				endTime: Number(new Date()),
				beginTimeShow : false,
				endTimeShow : false,
				total : 0,
				selectList : [
					[
						{
							label : 'PC机',
							val: 1
						},
						{
							label : '移动端',
							val: 2
						},
						{
							label : '充值机',
							val: 3
						},
						{
							label : 'P0S',
							val: 4
						},
						
					]
				],
				selectLabel : ''
			}
		},
		components:{
		},
		methods: {
			handleDetail(item){
				this.goPage('/pages/componentsC/safe/accessRecordDetail',{id:1})
			},
			scrolltolower(){
				if(this.total == this.list.length){
					return this.setMessage('没有更多了')
				}
				this.params.currPage ++
				this.getList()
			},
			goSearch(){
				this.params.currPage = 1 
				this.getList()
			},
			beginTimeConfirm(e){
				let date = this.dateformat(e.value).split(' ')[0]
				this.params.beginTime = date
				console.log(this.params.beginTime);
				this.beginTimeShow = false
			},
			endTimeConfirm(e){
				let date = this.dateformat(e.value).split(' ')[0]
				this.params.endTime = date
				this.endTimeShow = false
			},
			getList(){
				let params = this.params
				if(!params.endTime) delete params.endTime
				if(!params.beginTime) delete params.beginTime
				if(!params.transChannl) delete params.transChannl
				cardOperationlistApi(params).then(res=>{
					if(params.currPage==1) this.list = []
					this.list = this.list.concat(res.page.list)
					this.total = res.page.totalCount
				})
			},
			goSearch(){
				this.params.currPage = 1
				this.getList()
			}
			
		},
		onLoad() {
			let info = uni.getStorageSync('selectInfoAccount')
			this.params.mainframeNo = info.mainframeNo
			this.getList()
		},
		onShow() {
			
		},
	}
</script>

<style lang="scss" scoped>
.page{
	background-color: #f1f1f1;
	// height: 100vh;
	.searchBox{
		display: flex;
		align-items: center;
		background-color: #fff;
		padding: 0 20rpx;
		border-bottom: 1px solid #f1f1f1;
		margin: 20rpx;
		border-radius: 8rpx;
		box-shadow: 0px 6rpx 12rpx rgba(0, 0, 0, 0.16);
		.inputBox{
			flex: 1;
			padding-right: 30rpx;
			.inputRow{
				height: 80rpx;
				display: flex;
				align-items: center;
				font-size: 32rpx;
				padding-left: 20rpx;
				.label{
					color: #191919;
					margin-right: 30rpx;
				}
			}
			.input{
				
			}
			.emty{
				color: #c0c4cc;
			}
			.val{
				
			}
		}
		.btnBox{
			display: flex;
			flex-direction: column;
			padding: 10rpx 0;
			.reset{
				margin-top: 20rpx;
				border: 1px solid #f1f1f1;
				background: #fff !important;
				color: #353535 !important;
			}
			.btn{
				padding: 0 30rpx;
				// width: 110rpx;
				height: 60rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				background: #1890ff;
				border-radius: 8rpx;
				color: #fff;
			}
		}
	}
	
	.boxItem{
			background-color: #fff;
			margin: 20rpx;
			border-radius: 8rpx;
			padding: 10rpx;
			box-shadow: 0px 0px 20rpx 0px rgba(102,102,102,0.15);
			.row{
				margin: 10rpx;
				display: flex;
				.item{
					width: 50%;
					// flex: 1;
				}
				.label{
					color: #969696;
				}
				.val{
					color: #353535;
					font-size: 32rpx;
				}
				.btn{
						padding: 0 30rpx;
						width: 120rpx;
						height: 60rpx;
						display: flex;
						align-items: center;
						justify-content: center;
						background: #1890ff;
						border-radius: 8rpx;
						color: #fff;
				}
			}
		}
		
}
</style>
